<script>
export default {
  props: {
    titleKey: { // 接收语言包键名
      type: String,
      required: true
    }
  },
  mounted() {
    this.setTitle();
  },
  watch: {
    titleKey() { // 响应式更新标题
      this.setTitle();
    }
  },
  methods: {
    setTitle() {
      uni.setNavigationBarTitle({
        title: this.$t(this.titleKey)
      });
    }
  }
}
</script>